package com.woniuxy.springboot08rabbitmq.direct;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class DirectCustomer {
    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
            exchange = @Exchange(value = "x",type = "direct"),key = {"error"})
    })
    public void receiveMSG1(String msg){
        System.out.println("direct消费方1："+msg);
    }
    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
                    exchange = @Exchange(value = "x",type = "direct"),key = {"error","warning","info"})
    })
    public void receiveMSG2(String msg){
        System.out.println("direct消费方2："+msg);
    }
}
